package com.hice.demo.sbdbra.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.hice.demo.sbdbra.service.ActiveMQService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Queue;
import javax.jms.Topic;

/**
 * rabbit消息队列服务
 *
 * @author hyson
 * @create 2017-02-20 17:09
 */
@Component
@Service(version = "1.0.0")
public class ActiveMQServiceImpl implements ActiveMQService {
    @Autowired
    private JmsMessagingTemplate jmsTemplate;
    @Autowired
    private Queue queue;
    @Autowired
    private Topic topic;

    @Override
    public void sendQueue(String txt) {
        //send queue.
        this.jmsTemplate.convertAndSend(this.queue, txt);
    }

    @Override
    public void sendTopic(String txt) {
        //send topic.
        this.jmsTemplate.convertAndSend(this.topic, txt);
    }

}
